/*
 * @Author: chengsl
 * @Date: 2023-01-09 15:00:21
 * @LastEditors: chengsl
 * @LastEditTime: 2023-01-09 15:08:17
 * @Description: 柱图 widgetBarchart
 */
const arrColor = [{"color":"#0060FF"},{"color":"#3BD6FF"},{"color":"#948BEA"},{"color":"#F78D94"},{"color":"#FF7A45"},{"color":"#FCBB61"},{"color":"#36CFC0"}]
	.map(item=>{return item.color})

export default {
  grid: { left: 10, right: 40, bottom: 10, top: 50, containLabel: true },
  legend: { textStyle: { color: '#fff' } },
  xAxis: {
    type: 'category',
    show: true,
    name: '',
    nameTextStyle: { color: '#fff', fontSize: 14 },
    nameRotate: 0,
    axisLabel: {
      show: true,
      interval: 0,
      rotate: 0,
      textStyle: { color: '#fff', fontSize: 14 }
    },
    axisTick: { show: false },
    axisLine: { show: true, lineStyle: { color: 'rgba(32,45,92,0.5)' } },
    splitLine: { show: false, lineStyle: { color: 'rgba(32,45,92,0.5)' } },
    data: ['苹果', '三星', '小米', 'oppo', 'vivo']
  },
  yAxis: {
    type: 'value',
    scale: false,
    splitNumber: 0,
    show: true,
    name: '',
    nameTextStyle: { color: '#fff', fontSize: 14 },
    inverse: false,
    axisLabel: {
      show: true,
      rotate: 0,
      textStyle: { color: '#fff', fontSize: 14 }
    },
    axisLine: { show: true, lineStyle: { color: 'rgba(32,45,92,0.5)' } },
    splitLine: { show: false, lineStyle: { color: 'rgba(32,45,92,0.5)' } },
    splitArea: {
      show: true,
      areaStyle: { color: ['rgba(32,45,92,0.1)', 'rgba(32,45,92,0.5)'] }
    },
    data: []
  },
  series: [
    {
      data: [1000, 2229, 3879, 2379, 4079],
      type: 'bar',
      barGap: '0%',
      itemStyle: {
        normal: {
          color:  params => {
            return arrColor[params.dataIndex] || arrColor[arrColor.length - 1] || '#6495ed'
          },
          barBorderRadius: 0
        }
      },
      label: {
        show: false,
        position: 'top',
        distance: 5,
        fontSize: 14,
        color: '#fff',
        fontWeight: 'normal'
      },
      barWidth: 50,
      barMinHeight: 0
    }
  ],
  title: {
    text: '',
    show: true,
    left: 'center',
    textStyle: { color: '#FFD700', fontSize: 20, fontWeight: 'normal' },
    subtext: '',
    subtextStyle: { color: '#fff', fontWeight: 'normal', fontSize: 20 }
  },
  tooltip: {
    trigger: 'axis',
    show: true,
    axisPointer: { type: 'shadow' },
    textStyle: { fontSize: 16 }
  }
}
